from typing import Optional, List
from datetime import datetime
from pydantic import condecimal
from .base import BaseSchema

# 打包订单
class PackageOrderBase(BaseSchema):
    work_area_id: int
    customer_profile_id: int
    OrderNo: str
    OrderStatus: str
    TotalAmount: condecimal(max_digits=18, decimal_places=2)
    PaidAmount: condecimal(max_digits=18, decimal_places=2)
    UnpaidAmount: condecimal(max_digits=18, decimal_places=2)
    Remark: Optional[str] = None
    PDFUrl: Optional[str] = None
    ElevyStampUrl: Optional[str] = None
    CreatorUserName: Optional[str] = None

class PackageOrderCreate(PackageOrderBase):
    pass

class PackageOrderUpdate(PackageOrderBase):
    OrderNo: Optional[str] = None
    OrderStatus: Optional[str] = None
    TotalAmount: Optional[condecimal(max_digits=18, decimal_places=2)] = None
    PaidAmount: Optional[condecimal(max_digits=18, decimal_places=2)] = None
    UnpaidAmount: Optional[condecimal(max_digits=18, decimal_places=2)] = None

class PackageOrder(PackageOrderBase):
    ID: int
    CreateTime: datetime
    UpdateTime: Optional[datetime] = None

# 用车订单
class VehicleRentalBase(BaseSchema):
    work_area_id: int
    package_order_id: Optional[int] = None
    package_order_title: Optional[str] = None
    vehicle_type: str
    vehicle_count: int
    rental_start_date: datetime
    rental_end_date: datetime
    days: int
    daily_rate: float
    total_amount: float
    currency: str = "HKD"
    driver_included: bool = True
    notes: Optional[str] = None

class VehicleRentalCreate(VehicleRentalBase):
    pass

class VehicleRentalUpdate(VehicleRentalBase):
    pass

class VehicleRental(VehicleRentalBase):
    ID: int
    CreateTime: datetime
    UpdateTime: Optional[datetime] = None

# 其他订单类型的 schema... 